#!/usr/bin/perl

my $maxlines = $ARGV[0];

print STDERR "Extract the first $maxlines" . "k lines of text until empty line from stdin to stdout\n";
my $lines = 0;
while (my $line = <STDIN>) {
	print $line;
	++$lines;
	if ($line =~ /^\s*$/) {
		if ($lines >= $maxlines * 1000) {
			last;
		}
	}
}
